﻿using System;
using Character;
using UnityEngine;

// Token: 0x02000162 RID: 354
public class BustSoft
{
	// Token: 0x06000946 RID: 2374 RVA: 0x00036828 File Offset: 0x00034A28
	public BustSoft(Human human)
	{
		this.human = human;
	}

	// Token: 0x06000947 RID: 2375 RVA: 0x00036838 File Offset: 0x00034A38
	public void ReCalc()
	{
		BodyParameter body = this.human.customParam.body;
		float num = body.bustSoftness * body.shapeVals[1] + 0.01f;
		num = Mathf.Clamp(num, 0f, 1f);
		float stiffness = this.TreeLerp(BustSoft.bustStiffness, num);
		float elasticity = this.TreeLerp(BustSoft.bustElasticity, num);
		float damping = this.TreeLerp(BustSoft.bustDamping, num);
		this.human.body.bustDynamicBone_L.setSoftParams(0, -1, damping, elasticity, stiffness, true);
		this.human.body.bustDynamicBone_R.setSoftParams(0, -1, damping, elasticity, stiffness, true);
	}

	// Token: 0x06000948 RID: 2376 RVA: 0x000368E0 File Offset: 0x00034AE0
	private float TreeLerp(float[] vals, float rate)
	{
		if (rate < 0.5f)
		{
			return Mathf.Lerp(vals[0], vals[1], rate * 2f);
		}
		return Mathf.Lerp(vals[1], vals[2], (rate - 0.5f) * 2f);
	}

	// Token: 0x04000906 RID: 2310
	private static float[] bustDamping = new float[]
	{
		0.2f,
		0.1f,
		0.1f
	};

	// Token: 0x04000907 RID: 2311
	private static float[] bustElasticity = new float[]
	{
		0.2f,
		0.15f,
		0.05f
	};

	// Token: 0x04000908 RID: 2312
	private static float[] bustStiffness = new float[]
	{
		1f,
		0.1f,
		0.01f
	};

	// Token: 0x04000909 RID: 2313
	private Human human;
}
